﻿<!-- saved from url=(0014)about:internet -->
<html>
<head>
    <title></title>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script type="text/javascript">
        google.load("earth", "1");
        google.load('maps', '2.x', { 'other_params': 'sensor=false' });
        var ge;
        var geocoder;
        function init() {

            google.earth.createInstance('earth', initCallback, failureCB);
            geocoder = new GClientGeocoder();

        }

        function datacenters() {
            var googleDC = [
            { "vis": null, "lon": -122.072981, "id": 139138, "zoom": 15, "lat": 37.40047, "label": "Mountain View, Calif." }, { "vis": null, "lon": -121.897045, "id": 139139, "zoom": 15, "lat": 37.676033, "label": "Pleasanton, Calif." }, { "vis": null, "lon": -121.873881, "id": 139140, "zoom": 15, "lat": 37.316466, "label": "San Jose, Calif." }, { "vis": null, "lon": -118.243425, "id": 139141, "zoom": 15, "lat": 34.052187, "label": "Los Angeles, Calif." }, { "vis": null, "lon": -122.159928, "id": 139142, "zoom": 15, "lat": 37.437328, "label": "Palo Alto, Calif." }, { "vis": null, "lon": -122.347533, "id": 139143, "zoom": 15, "lat": 47.620716, "label": "Seattle" }, { "vis": null, "lon": -122.670132, "id": 139144, "zoom": 15, "lat": 45.523104, "label": "Portland, Oregon" }, { "vis": null, "lon": -121.181, "id": 139145, "zoom": 6, "lat": 45.593055, "label": "The Dalles, Oregon" }, { "vis": null, "lon": -87.624333, "id": 139146, "zoom": 15, "lat": 41.879535, "label": "Chicago" }, { "vis": null, "lon": -84.389663, "id": 139147, "zoom": 15, "lat": 33.754487, "label": "Atlanta, Ga. (two sites)" }, { "vis": null, "lon": -77.342285, "id": 139148, "zoom": 15, "lat": 38.951839, "label": "Reston, Virginia" }, { "vis": null, "lon": -77.486813, "id": 139149, "zoom": 9, "lat": 39.040344, "label": "Ashburn, Va." }, { "vis": null, "lon": -75.978706, "id": 139150, "zoom": 15, "lat": 36.85922, "label": "Virginia Beach, Virginia" }, { "vis": null, "lon": -95.362534, "id": 139151, "zoom": 15, "lat": 29.759956, "label": "Houston, Texas" }, { "vis": null, "lon": -80.190262, "id": 139152, "zoom": 15, "lat": 25.774252, "label": "Miami, Fla." }, { "vis": null, "lon": -81.53476, "id": 139153, "zoom": 6, "lat": 35.905373, "label": "Lenoir, North Carolina" }, { "vis": null, "lon": -79.986504, "id": 139154, "zoom": 15, "lat": 32.975074, "label": "Goose Creek, South Carolina" }, { "vis": null, "lon": -95.318348, "id": 139155, "zoom": 15, "lat": 36.308063, "label": "Pryor, Oklahoma" }, { "vis": null, "lon": -95.881859, "id": 139156, "zoom": 15, "lat": 41.261935, "label": "Council Bluffs, Iowa" }, { "vis": null, "lon": -79.386755, "id": 139157, "zoom": 15, "lat": 43.670233, "label": "Toronto, Canada" }, { "vis": null, "lon": 13.411494, "id": 139158, "zoom": 15, "lat": 52.52348, "label": "Berlin, Germany" }, { "vis": null, "lon": 8.680506, "id": 139159, "zoom": 15, "lat": 50.111512, "label": "Frankfurt, Germany" }, { "vis": null, "lon": 11.580214, "id": 139160, "zoom": 15, "lat": 48.139127, "label": "Munich, Germany" }, { "vis": null, "lon": 8.538033, "id": 139161, "zoom": 15, "lat": 47.369024, "label": "Zurich, Switzerland" }, { "vis": null, "lon": 6.567758, "id": 139162, "zoom": 15, "lat": 53.214882, "label": "Groningen, Netherlands" }, { "vis": null, "lon": 3.948737, "id": 139163, "zoom": 15, "lat": 50.453333, "label": "Mons, Belgium" }, { "vis": null, "lon": 6.825709, "id": 139164, "zoom": 15, "lat": 53.442105, "label": "Eemshaven, Netherlands" }, { "vis": null, "lon": 2.350987, "id": 139165, "zoom": 15, "lat": 48.856667, "label": "Paris" }, { "vis": null, "lon": -0.126236, "id": 139166, "zoom": 15, "lat": 51.500152, "label": "London" }, { "vis": null, "lon": -6.267494, "id": 139167, "zoom": 15, "lat": 53.344104, "label": "Dublin, Ireland" }, { "vis": null, "lon": 9.188126, "id": 139168, "zoom": 15, "lat": 45.463671, "label": "Milan, Italy" }, { "vis": null, "lon": 37.617633, "id": 139169, "zoom": 15, "lat": 55.755786, "label": "Moscow, Russia" }, { "vis": null, "lon": -46.638818, "id": 139170, "zoom": 15, "lat": -23.548943, "label": "Sao Paolo, Brazil" }, { "vis": null, "lon": 139.682282, "id": 139171, "zoom": 15, "lat": 35.678451, "label": "Tokyo" }, { "vis": null, "lon": 114.109497, "id": 139172, "zoom": 15, "lat": 22.396428, "label": "Hong Kong" }, { "vis": null, "lon": 116.395833, "id": 139173, "zoom": 4, "lat": 39.905556, "label": "Beijing" }, { "vis": null, "lon": 103.11789, "id": 145385, "zoom": 15, "lat": 5.308185, "label": "Chabang Tiga Homestay" }, { "vis": null, "lon": 14.465218, "id": 155545, "zoom": 12, "lat": 48.142723, "label": "Kronstorf, Linz-Land, Austria" }
            ];
            for (i = 0; i < googleDC.length; ++i) {

                // Create the placemark.
                var placemark = ge.createPlacemark('');
                placemark.setName(googleDC[i].label);

                // Define a custom icon.
                var icon = ge.createIcon('');
                icon.setHref('http://www.nrx.fr/bibliotheque/Divers/Drapeau%20Google.png');
                var style = ge.createStyle('');
                style.getIconStyle().setIcon(icon);
                style.getIconStyle().setScale(5.0);
                placemark.setStyleSelector(style);

                // Set the placemark's location.  
                var point = ge.createPoint('');
                point.setLatitude(googleDC[i].lat);
                point.setLongitude(googleDC[i].lon);
                placemark.setGeometry(point);                
                // Add the placemark to Earth.
                ge.getFeatures().appendChild(placemark);
               
            }
        }
        function LoadKML(href) {
            var networkLink = ge.createNetworkLink('');
            networkLink.setDescription('NetworkLink open to fetched content');
            networkLink.setName('Open NetworkLink');
            networkLink.setFlyToView(false);

            // NetworkLink/Link
            var link = ge.createLink('');
            link.setHref(href);
            networkLink.setLink(link);

            // add the network link to earth
            ge.getFeatures().appendChild(networkLink);

            // fetch kml to parse for tours
            google.earth.fetchKml(ge, href, function (kmlObject) {
                if (!kmlObject) {
                    // wrap alerts in API callbacks and event handlers
                    // in a setTimeout to prevent deadlock in some browsers
                    setTimeout(function () { }, 0);
                    return;
                }

                // Turn 3D buildings layer for 3D KMLs only.

                ge.getLayerRoot().enableLayerById(ge.LAYER_BUILDINGS, false);


                //                // Walk the loaded KML object hierarchy looking for a Tour
                //                walkKmlDom(kmlObject, function (context) {
                //                    if (this.getType() == 'KmlTour') {
                //                        ge.getTourPlayer().setTour(this);

                //                        ge.getTourPlayer().play();
                //                        currentTourKmlObject = this;
                //                        return false;
                //                    }
                //                });
            });
        }

        function initCallback(instance) {
            ge = instance;
            ge.getWindow().setVisibility(true);
            setTimeout("ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);", 2000);
            doGeocode('50 avenue des Champs-élysées, 75008 Paris, France');
            //earthquakes
            //LoadKML("http://services.google.com/earth/kmz/realtime_earthquakes_n.kmz");
            // LoadKML("https://maps.google.com/maps/ms?msid=200029211193069725767.0004c01364b9b07e482bf&msa=0&output=kml");
			 LoadKML("http://www.barnabu.co.uk/files/kmz/uksnow.kmz");
			 //datacenters();
        }
        function failureCB(errorCode) {
            alert(errorCode);
        }
        function doGeocode(address) {
            geocoder.getLatLng(address, function (point) {
                if (point) {
                    var lookAt = ge.createLookAt('');
                    lookAt.set(point.y, point.x, 10, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 30, 200);
                    //ge.getView().setAbstractView(lookAt);
                }
            });
        }
        google.setOnLoadCallback(init);
        function setLongitude(lookAt, speed) {
            lookAt.setLongitude(lookAt.getLongitude() + speed);
            ge.getView().setAbstractView(lookAt);
        }

        function setLatitude(lookAt, speed) {
            lookAt.setLatitude(lookAt.getLatitude() + speed);
            ge.getView().setAbstractView(lookAt);
        }
        function tiltLookAt(lookAt, angle) {
            lookAt.setTilt(lookAt.getTilt() + angle);
            ge.getView().setAbstractView(lookAt);
        }
        function tiltCamera(camera, angle) {
            camera.setTilt(camera.getTilt() + angle);
            ge.getView().setAbstractView(camera);
        }
        function rollCamera(camera, angle) {
            camera.setRoll(camera.getRoll() + angle);
            ge.getView().setAbstractView(camera);
        }
        function zoom(camera, altitude) {
            camera.setAltitude(altitude);
            ge.getView().setAbstractView(camera);
        }

        $(document).keypress(function (e) {
            var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
            var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
            if (e.which == 106) setLongitude(lookAt, -0.0001); //j
            if (e.which == 108) setLongitude(lookAt, 0.0001); //l
            if (e.which == 105) setLatitude(lookAt, 0.0001); //i
            if (e.which == 107) setLatitude(lookAt, -0.0001); //k
            if (e.which == 112) tiltLookAt(lookAt, -3); //p
            if (e.which == 109) tiltLookAt(lookAt, 3); //m
            if (e.which == 117) rollCamera(camera, -3); //u
            if (e.which == 111) rollCamera(camera, 3); //o
            if (e.which == 121) tiltCamera(camera, -3); //y
            if (e.which == 104) tiltCamera(camera, 3); //h
            if (e.which == 45) zoom(camera, camera.getAltitude() / 1.2); //-
            if (e.which == 43) zoom(camera, camera.getAltitude() * 1.2); //+
        });
    </script>
    <script type="text/javascript">
        function OnjKinectReady() {
            jKinect.initKinect(true, false);
        }

        function OnKinectReady() {
            jKinect.bind("SkeletonFrameReady", function (json) {
                var joints = jKinect.parseJSON(json);
                if (ge != undefined && ge.getView() != undefined) {
                    var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
                    if (joints["Head"].Z - joints["HipCenter"].Z < -0.15 || joints["Head"].Z - joints["HipCenter"].Z > 0.1)
                        zoom(camera, camera.getAltitude() * (Math.abs(1.0 + (joints["Head"].Z - joints["HipCenter"].Z) / 2.0)));
                }
            });
            jKinect.bind("HandsPosition", function (json) {
                var positions = jKinect.parseJSON(json);
                var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
                //                zoom(camera, camera.getAltitude() + (0.4 - Math.abs(positions["HandLeft"].X - positions["HandRight"].X)) * 5.0);
            });
            jKinect.bind("HandPosition", function (json) {
                var position = jKinect.parseJSON(json);
                if (position.X != -200 && position.Y != -200) {
                    var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
                    var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
                    lookAt.setLatitude(lookAt.getLatitude() + position.Y * (camera.getAltitude() / 1000000));
                    lookAt.setLongitude(lookAt.getLongitude() + position.X * (camera.getAltitude() / 1000000));
                    ge.getView().setAbstractView(lookAt);
                }
            });
            setInterval("jKinect.getNextSkeletonFrame()", 50);
        }
    </script>
</head>
<body>
    <div id="earth" style="height: 100%; width: 100%;">
    </div>
</body>
</html>
